<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/page/public/taglib.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>资源回收站</title>
    <% request.setAttribute("menu", 1); %>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<%@ include file="/WEB-INF/page/public/contentmeta.jsp"%>
<link rel="stylesheet" href="<%=basePath%>css/global.css" media="all" />
<link rel="stylesheet" href="<%=basePath%>plugins/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="<%=basePath%>css/system.css" media="all">
<link rel="stylesheet" href="<%=basePath%>css/tab.css" media="all" />
</head>
<body>
 <div class="admin-tab admin-user"> 
	 
    
      <div class="tab-condition">
        <form class="layui-form clefix" id="zyform" action="/customer/recyclebinlisturl" method="post">
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <input type="text" name="keyWord" id="keyWord"  autocomplete="off" placeholder="请输入关键字" class="layui-input" value="${pager.params.KeyWord }">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block" style="width:170px;">
                  <select name="state" id="state" lay-filter="state" class="typeclass">
                        <option value="">请选择状态</option>
                        <option value="-1" <c:if test="${pager.params.state == -1}">selected</c:if>>全部</option>
                        <option value="0" <c:if test="${pager.params.state == 0}">selected</c:if>>待恢复</option>
                        <option value="1" <c:if test="${pager.params.state == 1}">selected</c:if>>已恢复</option>
                       <%--  <option value="2" <c:if test="${pager.params.state == 2}">selected</c:if>>驳回</option> --%>
                    </select>
                </div>
            </div>
            <div class="layui-form-item">
	            <input name="skipToPage" id="skipToPage"  type="hidden" value="${pager.pageNo}">
				<input type="hidden" id="pageNo" name="pageNo" value="${pager.pageNo}">
				<input type="hidden" id="totalPage" name="totalPage" value="${pager.totalPages}">
                <button class="layui-btn TM-btn-search searchbtn" lay-submit="" lay-filter="demo2"><i class="layui-icon layui-unselect layui-tab-close">&#xe615;</i>搜索</button>
               <button class="layui-btn refreshbtn"  type="button"><i class="layui-icon layui-unselect layui-tab-close ">&#x1002;</i>刷新</button>  
            </div>
        </form>
    </div>
    <div  class="layui-field-box">
        <table class="site-table table-hover TM-table3">
            <thead>
            <tr>
                <th style="width:20%;">资源名称</th>
                <th style="width:8%;">成熟等级</th>
                <th style="width:8%;">所属人</th>
                <th style="width:5%;">类别</th>
                <th style="width:8%;">申请人</th>
                <th style="width:5%;">状态</th>
                <th style="width:26%;">审批意见</th>
                <th style="width:10%;">索要时间</th>
                <th style="width:10%;">操作</th>
            </tr>
            </thead>
            <tbody>
             <c:forEach var="obj" items="${pager.resultList}" varStatus="o1">
            	 <tr>
		                <td>${obj.customerInfo.cname}</td>
		                <td><dic:cf value="${obj.customerInfo.state}" name="customer_state" type="1"/></td>
		                <td>${obj.customerInfo.createusersname}</td>
		                <td>${obj.customerInfo.type==0?"个人":"企业"}</td>
		                <td>${obj.createuserName}</td>
		                <td><c:if test="${obj.state==0}">待恢复</c:if><c:if test="${obj.state==1}">已恢复</c:if><c:if test="${obj.state==2}">驳回</c:if> </td>
		                <td>${obj.opinion}</td>
		                <td>${obj.createdate.substring(0,19)}</td>
		                <td>
		                  <a href="/customer/findcustomer${obj.cusid}" target="_blank" class="layui-btn layui-btn-normal layui-btn-mini showinfo" data="${obj.id}">查看</a>
		                  <c:if test="${obj.state==0}"><button type="button" class="layui-btn layui-btn-normal layui-btn-mini askFor" data="${obj.id}">恢复资源</button></c:if>
		                </td>
		            </tr>
            
             </c:forEach>
           
             
            </tbody>
        </table>
        <div class="admin-table-page">
            <div id="page" class="page"></div>
        </div>
    </div>
  </div>

 

    <!-- 审核弹窗  -->
    <div class="layui-form hsorapprove"  style="display:none">
			<div class="TM-booking-to" style="padding:10px 20px;">
    			<div class="layui-form-item">
					<label class="layui-form-label" id="opin">理由：</label>
				    <div class="layui-input-block" style="width:60%">
				      	<textarea name="remark" id="askforopinion" placeholder="请输入内容" class="layui-textarea"></textarea>
				    </div>
			    </div>
			</div>
    </div>

<script>
layui.use(['laypage','form','laydate'], function() {
    var $ = layui.jquery,
            layer = layui.layer,
            laypage = layui.laypage;
            var form = layui.form(); 
        //审核弹窗
        $('.askFor').on('click',function(){
        	var id =$(this).attr("data");
            layer.open({
                type:1,
                content:$('.hsorapprove'),
                btn:['恢复','取消'],
                btnAlign:'c',
                shade: [.6,'#000'],
                shadeClose:true,
                title:'资源恢复',
            	area:['35%','320px'],
                maxWidth:800,
                yes: function(layero, index){
                	opinion =$("#askforopinion").val()
                	$.ajax({
        				type : "post",
        				url : "/customer/recyclebinsave",
        				data : {id:id,state:1,opinion:opinion},
        				dataType : "json",
        				success : function(data){
        					if(data=="1"){
        						 layer.close(layero);
        						 layer.msg("恢复成功",{icon: 1},function(){
        							 $("#zyform").submit();
            					});
        					}else{
        						layer.msg("恢复失败",{icon: 2} );
        					} 
        				}
        			});
                	
                },
               btn2: function(layero, index){
            	  /*  opinion =$("#askforopinion").val()
            	   if(opinion.length<1){
            		   layer.tips("请填写驳回理由", $("#askforopinion"), {
        					tips: [2,tipColor],
        	     		 tipsMore: true
        	     		});
            		   return false;
            	   }
            	   
            	   
            	   $.ajax({
	       				type : "post",
	       				url : "/customer/recyclebinsave",
	       				data : {id:id,state:2,opinion:opinion},
	       				dataType : "json",
	       				success : function(data){
	       					if(data=="1"){
	       						 layer.closeAll();
	       						 layer.msg("驳回成功",{icon: 1},function(){
	       							 $("#zyform").submit();
	           					});
	       					}else{
	       						layer.msg("驳回失败",{icon: 2} );
	       					} 
	       				}
	       			}); */
            	   layer.closeAll();
            	   return false;
               }
            });
        });

        //page
        laypage({
            cont: 'page',
            curr:'${pager.pageNo}'
            ,pages: '${pager.totalPages}' //总页数
            ,
            groups: 5 //连续显示分页数
            ,
            jump: function(obj, first) {
                //得到了当前页，用于向服务端请求对应数据
                var curr = obj.curr;
                if(!first) {
                	 $("#skipToPage").val(curr);
                	 $("#zyform").submit();
                    //layer.msg('第 '+ obj.curr +' 页');
                }
            }
        });
    });
</script>
</body>

</html>